﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace LaunchPad.Core.Controls
{
    /// <summary>
    /// Interaction logic for ShowControl.xaml
    /// </summary>
    public partial class ShowControl : UserControl
    {
        public ShowControl()
        {
            InitializeComponent();
        }

        private void AbortButtonClick(object sender, RoutedEventArgs e)
        {
            if (Abort != null)
                Abort(this, EventArgs.Empty);
        }

        public event EventHandler Abort;
        public event EventHandler Pause;
        public event EventHandler Play;

        public TimeSpan Lapsed
        {
            set
            {
                lapsedTextBlock.Text = value.ToString("hh\\:mm\\:ss");
            }
        }

        public TimeSpan Remaining
        {
            set
            {
                remainingTextBlock.Text = value.ToString("hh\\:mm\\:ss");
            }
        }

        private void PauseButtonChecked(object sender, RoutedEventArgs e)
        {
            if (Pause != null)
                Pause(this, EventArgs.Empty);
        }

        private void PauseButtonUnchecked(object sender, RoutedEventArgs e)
        {
            if (Play != null)
                Play(this, EventArgs.Empty);
        }

        public void SetPaused(bool pause)
        {
            pauseButton.IsChecked = pause;
        }
    }
}
